package prodcon;

public class Consumer implements Runnable {
	private Buffer input;

	public Consumer(Buffer buffer) {
		input = buffer;
		new Thread(this).start();
	}

	public void run() {
		try {
			for (;;) {
				int datum = input.get();
				System.out.println("           Got " + datum);
				Thread.sleep(1000);
			}
        } catch (InterruptedException ie) {
        	System.out.println("Receiver completed");
        	return;
        }
    }
}